﻿using System;
using System.Web.Services;
using Monkey.Warrenty.Biz;
using MonkeyWarranty.Web.Common;

namespace MonkeyWarranty.Web.User
{
    public partial class Default : System.Web.UI.Page
    {
        private static WarrantyProductBiz _warrantyProductBiz;
        private static WarrantyProductBiz WarrantyProductManager
        {
            get { return _warrantyProductBiz ?? (_warrantyProductBiz = new WarrantyProductBiz()); }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        [WebMethod(EnableSession = true)]
        public static object ProductsAtTechnical(int jtStartIndex, int jtPageSize, string jtSorting)
        {
            //System.Threading.Thread.Sleep(1000);
            var productCount = WarrantyProductManager.GetProcessingWarrantyProductsCount(WarrantyCommon.CurrrentEmployee.Id);
            var warrantyProductViews = WarrantyProductManager.GetProcessingWarrantyProducts(WarrantyCommon.CurrrentEmployee.Id, jtStartIndex, jtPageSize, jtSorting);

            return new { Result = "OK", Records = warrantyProductViews, TotalRecordCount = productCount };
        }
    }
}